home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 98 / Skunkware 98.iso / src / mail / pine3.96.tar.gz / pine3.96.tar / pine3.96 / imap / ANSI / c-client / smtp.h < prev    next >
C/C++ Source or Header  |  1996-02-06  |  4KB  |  109 lines

  1. /*
  2.  * Program:    Simple Mail Transfer Protocol (SMTP) routines
  3.  *
  4.  * Author:    Mark Crispin
  5.  *        Networks and Distributed Computing
  6.  *        Computing & Communications
  7.  *        University of Washington
  8.  *        Administration Building, AG-44
  9.  *        Seattle, WA  98195
  10.  *        Internet: MRC@CAC.Washington.EDU
  11.  *
  12.  * Date:    27 July 1988
  13.  * Last Edited:    31 January 1996
  14.  *
  15.  * Sponsorship:    The original version of this work was developed in the
  16.  *        Symbolic Systems Resources Group of the Knowledge Systems
  17.  *        Laboratory at Stanford University in 1987-88, and was funded
  18.  *        by the Biomedical Research Technology Program of the National
  19.  *        Institutes of Health under grant number RR-00785.
  20.  *
  21.  * Original version Copyright 1988 by The Leland Stanford Junior University
  22.  * Copyright 1994 by the University of Washington
  23.  *
  24.  *  Permission to use, copy, modify, and distribute this software and its
  25.  * documentation for any purpose and without fee is hereby granted, provided
  26.  * that the above copyright notices appear in all copies and that both the
  27.  * above copyright notices and this permission notice appear in supporting
  28.  * documentation, and that the name of the University of Washington or The
  29.  * Leland Stanford Junior University not be used in advertising or publicity
  30.  * pertaining to distribution of the software without specific, written prior
  31.  * permission.  This software is made available "as is", and
  32.  * THE UNIVERSITY OF WASHINGTON AND THE LELAND STANFORD JUNIOR UNIVERSITY
  33.  * DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD TO THIS SOFTWARE,
  34.  * INCLUDING WITHOUT LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
  35.  * FITNESS FOR A PARTICULAR PURPOSE, AND IN NO EVENT SHALL THE UNIVERSITY OF
  36.  * WASHINGTON OR THE LELAND STANFORD JUNIOR UNIVERSITY BE LIABLE FOR ANY
  37.  * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
  38.  * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
  39.  * CONTRACT, TORT (INCLUDING NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF
  40.  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  41.  *
  42.  */
  43.  
  44. /* Constants */
  45.  
  46. #define SMTPTCPPORT (long) 25    /* assigned TCP contact port */
  47. #define SMTPGREET (long) 220    /* SMTP successful greeting */
  48. #define SMTPOK (long) 250    /* SMTP OK code */
  49. #define SMTPREADY (long) 354    /* SMTP ready for data */
  50. #define SMTPSOFTFATAL (long) 421/* SMTP soft fatal code */
  51. #define SMTPHARDERROR (long) 554/* SMTP miscellaneous hard failure */
  52.  
  53.  
  54. /* SMTP open options */
  55.  
  56. #define SOP_DEBUG (long) 1    /* debug protocol negotiations */
  57. #define SOP_ESMTP (long) 2    /* ESMTP requested */
  58.  
  59.  
  60. /* SMTP I/O stream */
  61.  
  62. typedef struct smtp_stream {
  63.   void *tcpstream;        /* TCP I/O stream */
  64.   char *reply;            /* last reply string */
  65.   unsigned long size;        /* size limit */
  66.   unsigned int debug : 1;    /* stream debug flag */
  67.   unsigned int ehlo : 1;    /* doing EHLO processing */
  68.   unsigned int esmtp : 1;    /* support ESMTP */
  69.   unsigned int ok_send : 1;    /* supports SEND */
  70.   unsigned int ok_soml : 1;    /* supports SOML */
  71.   unsigned int ok_saml : 1;    /* supports SAML */
  72.   unsigned int ok_expn : 1;    /* supports EXPN */
  73.   unsigned int ok_help : 1;    /* supports HELP */
  74.   unsigned int ok_turn : 1;    /* supports TURN */
  75.   unsigned int ok_size : 1;    /* supports SIZE */
  76.   unsigned int ok_8bitmime : 1;    /* supports 8-bit MIME */
  77. } SMTPSTREAM;
  78.  
  79. /* Coddle certain compilers' 6-character symbol limitation */
  80.  
  81. #ifdef __COMPILER_KCC__
  82. #define smtp_open sopen
  83. #define    smtp_greeting sgreet
  84. #define smtp_close sclose
  85. #define smtp_mail smail
  86. #define smtp_debug sdebug
  87. #define smtp_nodebug sndbug
  88. #define smtp_rcpt srcpt
  89. #define smtp_address saddr
  90. #define smtp_send ssend
  91. #define smtp_reply sreply
  92. #define smtp_fake sfake
  93. #endif
  94.  
  95.  
  96. /* Function prototypes */
  97.  
  98. SMTPSTREAM *smtp_open (char **hostlist,long options);
  99. long smtp_greeting (SMTPSTREAM *stream,char *lhost,long options);
  100. SMTPSTREAM *smtp_close (SMTPSTREAM *stream);
  101. long smtp_mail (SMTPSTREAM *stream,char *type,ENVELOPE *msg,BODY *body);
  102. void smtp_debug (SMTPSTREAM *stream);
  103. void smtp_nodebug (SMTPSTREAM *stream);
  104. void smtp_rcpt (SMTPSTREAM *stream,ADDRESS *adr,long *error);
  105. long smtp_send (SMTPSTREAM *stream,char *command,char *args);
  106. long smtp_reply (SMTPSTREAM *stream);
  107. long smtp_fake (SMTPSTREAM *stream,long code,char *text);
  108. long smtp_soutr (void *stream,char *s);
  109.